'''
56需求:编写一个程序，实现简单秒表功能。该程序在用户按下回车键后开始计时，在用户中断程序时停止
计时
'''
import time
start_time=time.time()
try:
	while True:
		print(f"\r已经过了{int(time.time()-start_time)}秒",end="")
		time.sleep(1)
except KeyboardInterrupt:
	end_time=time.time()
	total_time=round(end_time-start_time, 2)
	print(f"\n总共运行{total_time}秒")





